// 运营日报
app.controller('dailypaper', ['$scope', '$http', 'commonFactory', 'toaster', '$timeout', '$modal', function ($scope, $http, commonFactory, toaster, $timeout, $modal) {
    var today, yestoday, todaymonth, todayday, yesmonth, yesday, starttime, endtime;
    today = new Date(),
        yestoday = new Date(today.getTime() - 86400000),
        todaymonth = today.getMonth() + 1,
        todayday = today.getDate(),
        yesmonth = yestoday.getMonth() + 1,
        yesday = yestoday.getDate(),
        todaymonth = todaymonth > 9 ? todaymonth : ('0' + todaymonth),
        todayday = todayday > 9 ? todayday : '0' + todayday;
    yesmonth = yesmonth > 9 ? yesmonth : ('0' + yesmonth),
        yesday = yesday > 9 ? yesday : '0' + yesday;
    starttime = yestoday.getFullYear() + '-' + yesmonth + '-' + yesday;
    endtime = today.getFullYear() + '-' + todaymonth + '-' + todayday;
    $scope.dailypaperData = {
        StartDate: starttime,
        EndDate: endtime
    }
    var getdailypaper = function () {
        if (!$scope.dailypaperData.StartDate || !$scope.dailypaperData.EndDate) {
            toaster.pop('warning', '提示', "开始时间和结束时间必填");
            $scope.graybtn = false;
            return;
        } else {
            $scope.dailypaperData.StartDate = commonFactory.DateFormat($scope.dailypaperData.StartDate, 1)
            $scope.dailypaperData.EndDate = commonFactory.DateFormat($scope.dailypaperData.EndDate, 1)
        }
        commonFactory.loading(true)
        commonFactory.ajax("/api/Statistics/QueryBusinessDay", $scope.dailypaperData, function (result) {
            $scope.graybtn = false;
            commonFactory.loading(false)
            if (result.Code == 1) {
                $scope.dailypaperList = JSON.parse(result.Data);
            } else {
                toaster.pop('error', '失败', result.ResposeData)
            }
        }, function () {
            commonFactory.loading(false)
            $scope.graybtn = false;
        }, "post");
    }
    getdailypaper()
    $scope.querydata = function () {
        $scope.graybtn = true;
        getdailypaper()
    }
    //导出
    $scope.export = function () {
        var uId = localStorage.getItem('u_id') || '';
        $scope.dailypaperData.StartDate = commonFactory.DateFormat($scope.dailypaperData.StartDate, 1)
        $scope.dailypaperData.EndDate = commonFactory.DateFormat($scope.dailypaperData.EndDate, 1)
        $scope.gourl = commonFactory.baseurl + '/api/Statistics/ExportBusinessDailyDay?StartDate=' + $scope.dailypaperData.StartDate + '&EndDate=' + $scope.dailypaperData.EndDate + '&u_Id=' + uId;
    }
}]);
// 运营月报
app.controller('monthlymagazine', ['$scope', '$http', 'commonFactory', 'toaster', '$timeout', '$modal', function ($scope, $http, commonFactory, toaster, $timeout, $modal) {
    // 上个月
    function getPreMonth(date) {
        var arr = date.split('-');
        var year = arr[0]; //获取当前日期的年份
        var month = arr[1]; //获取当前日期的月份
        var day = arr[2]; //获取当前日期的日
        var days = new Date(year, month, 0);
        days = days.getDate(); //获取当前日期中月的天数
        var year2 = year;
        var month2 = parseInt(month) - 1;
        if (month2 == 0) {
            year2 = parseInt(year2) - 1;
            month2 = 12;
        }
        if (month2 < 10) {
            month2 = '0' + month2;
        }
        var t2 = year2 + '-' + month2;
        return t2;
    }
    var currentmonth, todaymonth, todayday, starttime, endtime;
    currentmonth = new Date(),
        todaymonth = currentmonth.getMonth() + 1,
        todayday = currentmonth.getDate(),
        todaymonth = todaymonth > 9 ? todaymonth : ('0' + todaymonth),
        todayday = todayday > 9 ? todayday : '0' + todayday;
    endtime = currentmonth.getFullYear() + '-' + todaymonth;
    starttime = getPreMonth(endtime + '-01');
    $scope.dailypaperData = {
        StartDate: starttime + '-01',
        EndDate: endtime + '-01'
    }
    $('#starttimepicker').val(starttime)
    $('#endtimepicker').val(endtime)
    $('#starttimepicker').datetimepicker({
        language: 'zh-CN',
        todayBtn: 1,
        autoclose: 1,
        todayHighlight: 1,
        minView: 3,
        forceParse: 0,
        todayBtn: "linked",
        keyboardNavigation: false,
        showMeridian: true,
        format: 'yyyy-mm',
        endDate: $scope.dailypaperData.EndDate,
        startView: 'year',
        pickerPosition: "bottom-right"
    }).on('changeMonth', function (ev) {
        var myear = ev.date.getFullYear()
        var mon = (ev.date.getMonth() + 1) > 9 ? (ev.date.getMonth() + 1) : '0' + (ev.date.getMonth() + 1)
        var date = myear + '-' + mon
        $scope.dailypaperData.StartDate = date + '-01';
    });
    $('#endtimepicker').datetimepicker({
        language: 'zh-CN',
        todayBtn: 1,
        autoclose: 1,
        todayHighlight: 1,
        minView: 3,
        forceParse: 0,
        todayBtn: "linked",
        keyboardNavigation: false,
        showMeridian: true,
        format: 'yyyy-mm',
        endDate: $scope.dailypaperData.EndDate,
        startView: 'year',
        pickerPosition: "bottom-right"
    }).on('changeMonth', function (ev) {
        var myear = ev.date.getFullYear()
        var mon = (ev.date.getMonth() + 1) > 9 ? (ev.date.getMonth() + 1) : '0' + (ev.date.getMonth() + 1)
        var date = myear + '-' + mon
        $scope.dailypaperData.EndDate = date + '-01';
    });
    var getmonthlymagazine = function () {
        if (!$scope.dailypaperData.StartDate || !$scope.dailypaperData.EndDate) {
            toaster.pop('warning', '提示', "开始时间和结束时间必填");
            $scope.graybtn = false;
            return;
        } else {
            $scope.dailypaperData.StartDate = commonFactory.DateFormat($scope.dailypaperData.StartDate, 1)
            $scope.dailypaperData.EndDate = commonFactory.DateFormat($scope.dailypaperData.EndDate, 1)
        }
        commonFactory.loading(true)
        commonFactory.ajax("/api/Statistics/QueryBusinessMonth", $scope.dailypaperData, function (result) {
            $scope.graybtn = false;
            commonFactory.loading(false)
            if (result.Code == 1) {
                $scope.dailypaperList = JSON.parse(result.Data);
            } else {
                toaster.pop('error', '失败', result.ResposeData)
            }
        }, function () {
            commonFactory.loading(false)
            $scope.graybtn = false;
        }, "post");
    }
    getmonthlymagazine()
    $scope.querydata = function () {
        $scope.graybtn = true;
        getmonthlymagazine()
    }
    //导出
    $scope.export = function () {
        var uId = localStorage.getItem('u_id') || '';
        $scope.dailypaperData.StartDate = commonFactory.DateFormat($scope.dailypaperData.StartDate, 1)
        $scope.dailypaperData.EndDate = commonFactory.DateFormat($scope.dailypaperData.EndDate, 1)
        $scope.gourl = commonFactory.baseurl + '/api/Statistics/ExportBusinessDailyMonth?StartDate=' + $scope.dailypaperData.StartDate + '&EndDate=' + $scope.dailypaperData.EndDate + '&u_Id=' + uId;
    }
}]);
// 投资分布
app.controller('investdistribution', ['$scope', '$http', 'commonFactory', 'toaster', '$timeout', '$modal', function ($scope, $http, commonFactory, toaster, $timeout, $modal) {
    var today, yestoday, todaymonth, todayday, yesmonth, yesday, starttime, endtime;
    today = new Date(),
        yestoday = new Date(today.getTime() - 86400000),
        todaymonth = today.getMonth() + 1,
        todayday = today.getDate(),
        yesmonth = yestoday.getMonth() + 1,
        yesday = yestoday.getDate(),
        todaymonth = todaymonth > 9 ? todaymonth : ('0' + todaymonth),
        todayday = todayday > 9 ? todayday : '0' + todayday;
    yesmonth = yesmonth > 9 ? yesmonth : ('0' + yesmonth),
        yesday = yesday > 9 ? yesday : '0' + yesday;
    starttime = yestoday.getFullYear() + '-' + yesmonth + '-' + yesday;
    endtime = today.getFullYear() + '-' + todaymonth + '-' + todayday;
    $scope.investData = {
        Index: 1,
        Size: 10,
        StartDate: starttime,
        EndDate: endtime
    }
    //下一页
    $scope.next = function () {
        if ($scope.page) {
            if ($scope.investData.Index >= $scope.page) {//判断最大页码
                $scope.investData.Index = $scope.page;
                return false;
            }
            $scope.investData.Index++
            getinvestdistribution();
        }
    }
    //上一页
    $scope.prev = function () {
        if ($scope.investData.Index <= 1) {//判断最小页码
            $scope.investData.Index = 1;
            return false;
        }
        $scope.investData.Index--;
        getinvestdistribution()
    }
    var getinvestdistribution = function () {
        if (!$scope.investData.StartDate || !$scope.investData.EndDate) {
            toaster.pop('warning', '提示', "开始时间和结束时间必填");
            $scope.graybtn = false;
            return;
        } else {
            $scope.investData.StartDate = commonFactory.DateFormat($scope.investData.StartDate, 1)
            $scope.investData.EndDate = commonFactory.DateFormat($scope.investData.EndDate, 1)
        }
        commonFactory.loading(true)
        commonFactory.ajax("/api/Statistics/InvestDistribution", $scope.investData, function (result) {
            $scope.graybtn = false;
            commonFactory.loading(false)
            if (result.Code == 1) {
                var data = JSON.parse(result.Data)
                $scope.investdistList = data.List;
                $scope.QueryListTotal = data.Count;
                $scope.page = Math.ceil(data.Count / $scope.investData.Size);
            } else {
                toaster.pop('error', '失败', result.ResposeData)
            }
        }, function () {
            commonFactory.loading(false)
            $scope.graybtn = false;
        }, "post");
    }
    getinvestdistribution()
    $scope.querydata = function () {
        $scope.graybtn = true;
        getinvestdistribution()
    }
    //导出
    $scope.export = function () {
        var uId = localStorage.getItem('u_id') || '';
        $scope.investData.StartDate = commonFactory.DateFormat($scope.investData.StartDate, 1)
        $scope.investData.EndDate = commonFactory.DateFormat($scope.investData.EndDate, 1)
        $scope.gourl = commonFactory.baseurl + '/api/Statistics/ExportInvestDistribution?Size=' + $scope.investData.Size + '&Index=' + $scope.investData.Index + '&StartDate=' + $scope.investData.StartDate + '&EndDate=' + $scope.investData.EndDate + '&u_Id=' + uId;
    }
}]);
// 实时数据
app.controller('realtimedata', ['$scope', '$http', 'commonFactory', 'toaster', '$timeout', '$modal', function ($scope, $http, commonFactory, toaster, $timeout, $modal) {
    commonFactory.loading(true)
    commonFactory.ajax("/api/operation/GetOperationDay", {}, function (result) {
        if (result.Code == 1) {
            $scope.GetOperationDay = result.Data;
        } else {

        }
    }, function () {
        toaster.pop('error', '失败', '后台返回报错');
    }, "get");
    $scope.newdata = {
        colors: ['#5586ff', '#f3578a', '#ffa14d'],
        series: { shadowSize: 2 },
        xaxis: { font: { color: '#ccc' }, ticks: [[0, '0点'], [1, '1点'], [2, '2点'], [3, '3点'], [4, '4点'], [5, '5点'], [6, '6点'], [7, '7点'], [8, '8点'], [9, '9点'], [10, '10点'], [11, '11点'], [12, '12点'], [13, '13点'], [14, '14点'], [15, '15点'], [16, '16点'], [17, '17点'], [18, '18点'], [19, '19点'], [20, '20点'], [21, '21点'], [22, '22点'], [23, '23点'], [24, '24点']], tickDecimals: 0 },
        yaxis: { font: { color: '#ccc' }, ticks: [[0, '0万'], [5, '5万'], [10, '10万'], [15, '15万'], [20, '20万'], [25, '25万'], [30, '30万'], [35, '35万'], [40, '40万'], [45, '45万'], [50, '50万']] },
        grid: { hoverable: true, clickable: false, borderWidth: 0, color: '#333' },
        tooltip: true,
        tooltipOpts: {
            content: function (label, xval, yval) {
                if (label == '充值金额') {
                    yval = ($scope.show1[xval][1] / 10000).toFixed(0)
                } else if (label == '投资金额') {
                    yval = ($scope.show2[xval][1] / 10000).toFixed(0)
                } else if (label == '提现金额') {
                    yval = ($scope.show3[xval][1] / 10000).toFixed(0)
                }
                var content = xval + '点' + label + yval + '万元';
                return content;
            }, defaultTheme: false, shifts: { x: 0, y: 20 }
        }
    }
    function deepClone(obj) {
        var newObj = obj.constructor === Array ? [] : {};
        if (typeof obj !== 'object') {
            return
        } else {
            for (var i in obj) {
                if (obj.hasOwnProperty(i)) {
                    newObj[i] = typeof obj[i] === 'object' ? deepClone(obj[i]) : obj[i];
                }
            }
        }
        return newObj
    }
    commonFactory.ajax("/api/operation/GetAmountTrend", {}, function (result) {
        commonFactory.loading(false)
        if (result.Code == 1) {
            let arr = [0, 0]
            result.Data.ListRecharge.unshift(arr);
            result.Data.ListInvestor.unshift(arr);
            result.Data.ListWithdraw.unshift(arr);
            $scope.show1 = result.Data.ListRecharge;
            $scope.show2 = result.Data.ListInvestor;
            $scope.show3 = result.Data.ListWithdraw;//hover数据用
            $scope.d0_1 = deepClone(result.Data.ListRecharge);
            $scope.d0_2 = deepClone(result.Data.ListInvestor);
            $scope.d0_3 = deepClone(result.Data.ListWithdraw);
            $scope.d0_1.forEach(ele => {//处理万元
                ele[1] = (ele[1] / 10000).toFixed(0)
                if (ele[1] > 50) {
                    ele[1] = 55
                }
            });
            $scope.d0_2.forEach(ele => {
                ele[1] = (ele[1] / 10000).toFixed(0);
                if (ele[1] > 50) {
                    ele[1] = 55
                }
            });
            $scope.d0_3.forEach(ele => {
                ele[1] = (ele[1] / 10000).toFixed(0);
                if (ele[1] > 50) {
                    ele[1] = 55
                }
            });
            $scope.dataname = [
                { data: $scope.d0_1, label: '充值金额', points: { show: true }, lines: { show: true, fill: false } },
                { data: $scope.d0_2, label: '投资金额', points: { show: true }, lines: { show: true, fill: false } },
                { data: $scope.d0_3, label: '提现金额', points: { show: true }, lines: { show: true, fill: false } }
            ]
            $.plot('#flot', $scope.dataname, $scope.newdata).draw();

        } else {

        }
    }, function () {
        toaster.pop('error', '失败', '后台返回报错');
    }, "get");

    $scope.uptop = function (type) {
        var modalInstance = $modal.open({
            templateUrl: 'tpl/model/delPmodel.html?v=' + Math.random(),
            controller: ['$scope', '$modalInstance', 'raise', function ($scope, $modalInstance) {
                $scope.toplist = type;
                if (type == 1) {//投资额10
                    commonFactory.loading(true)
                    commonFactory.ajax("/api/operation/GetOperationTender", {}, function (result) {
                        commonFactory.loading(false)
                        if (result.Code == 1) {
                            $scope.GetOperationTender = result.Data
                        }
                    }, function () {
                        toaster.pop('error', '失败', '后台返回报错');
                    }, "get");
                } else {//提现额10
                    commonFactory.loading(true)
                    commonFactory.ajax("/api/operation/GetOperationWithdraw", {}, function (result) {
                        commonFactory.loading(false)
                        if (result.Code == 1) {
                            $scope.GetOperationWithdraw = result.Data
                        }
                    }, function () {
                        toaster.pop('error', '失败', '后台返回报错');
                    }, "get");
                }

                $scope.cancel = function () {
                    $modalInstance.close();
                };
            }
            ],
            size: 'lg',
            backdrop: true,
            resolve: {
                raise: function () {
                    return;
                }
            }
        });
        modalInstance.result.then(function () {
        }, function () {
        });
    }
}]);
// 运营日报
app.controller('operatdaily', ['$scope', '$http', 'commonFactory', 'toaster', '$timeout', '$modal', function ($scope, $http, commonFactory, toaster, $timeout, $modal) {
    var objdate = new Date()
    var date = objdate.getDate() - 1;
    var year = objdate.getFullYear();
    var month = objdate.getMonth() + 1
    var newdate = year + '-' + month + '-' + date;
    $('#datetimepicker').val(newdate)
    $('#datetimepicker').datetimepicker({
        language: 'zh-CN',
        autoclose: 1,
        startView: 2,
        minView: 4,
        forceParse: 0,
        todayBtn: false,
        keyboardNavigation: false,
        showMeridian: true,
        format: 'yyyy-mm-dd',
        endDate: newdate,
        pickerPosition: "bottom-right"
    }).on('changeDate', function (ev) {
        var myear = ev.date.getFullYear();
        var mon = ev.date.getMonth() + 1;
        var mdate = ev.date.getDate();
        newdate = myear + '-' + mon + '-' + mdate;
    });
    $scope.clickbtn = function () {//查询
        initdata(newdate)
    }
    $scope.ngshow = 1
    $scope.select = function (type) {
        $scope.ngshow = type;
        initdata(newdate)
    }
    function deepClone(obj) {
        var newObj = obj.constructor === Array ? [] : {};
        if (typeof obj !== 'object') {
            return
        } else {
            for (var i in obj) {
                if (obj.hasOwnProperty(i)) {
                    newObj[i] = typeof obj[i] === 'object' ? deepClone(obj[i]) : obj[i];
                }
            }
        }
        return newObj
    }
    var initdata = function (datetime) {
        commonFactory.loading(true)
        commonFactory.ajax("/Api/FixedOperation/GetOperationDay", { date: datetime }, function (result) {
            if (result.Code == 1) {
                $scope.GetOperationDay = result.Data;
                if (result.Data) {//昨天投资金额比较今天
                    $scope.RechargePrice = Math.abs(1 - result.Data.RechargePrice / result.Data.RechargePriceYesterday) * 100;
                    $scope.NewInvestorPrice = Math.abs(1 - result.Data.NewInvestorPrice / result.Data.NewInvestorPriceYesterday) * 100;
                    $scope.InvestorPrice = Math.abs(1 - result.Data.InvestorPrice / result.Data.InvestorPriceYesterday) * 100;
                    $scope.WithdrawPrice = Math.abs(1 - result.Data.WithdrawPrice / result.Data.WithdrawPriceYesterday) * 100;
                    $scope.RegisteredNum = Math.abs(1 - result.Data.RegisteredNum / result.Data.RegisteredNumYesterday) * 100;
                    $scope.RealNameNum = Math.abs(1 - result.Data.RealNameNum / result.Data.RealNameNumYesterday) * 100;
                    $scope.InvestorNum = Math.abs(1 - result.Data.InvestorNum / result.Data.InvestorNumYesterday) * 100;
                    $scope.WithdrawNum = Math.abs(1 - result.Data.WithdrawNum / result.Data.WithdrawNumYesterday) * 100;
                    $scope.FlexibleHoldPrice = Math.abs(1 - result.Data.FlexibleHoldPrice / result.Data.FlexibleHoldPriceYesterday) * 100;
                    $scope.TiroProHoldPrice = Math.abs(1 - result.Data.TiroProHoldPrice / result.Data.TiroProHoldPriceYesterday) * 100;
                    $scope.ProductHoldPrice = Math.abs(1 - result.Data.ProductHoldPrice / result.Data.ProductHoldPriceYesterday) * 100;
                    $scope.UsablePrice = Math.abs(1 - result.Data.UsablePrice / result.Data.UsablePriceYesterday) * 100;
                }

            } else {

            }
        }, function () {
            toaster.pop('error', '失败', '后台返回报错');
        }, "get");
        var txt = '';
        var people = '';
        var tf = true
        commonFactory.ajax("/Api/FixedOperation/GetAmountTrend", { date: datetime }, function (result) {
            commonFactory.loading(false)
            if (result.Code == 1) {
                if ($scope.ngshow == 1) {
                    if(result.Data.ListRecharge.length && result.Data.ListInvestor.length && result.Data.ListWithdraw.length){
                        let arr = [0, 0];
                        result.Data.ListRecharge.unshift(arr)
                        result.Data.ListInvestor.unshift(arr)
                        result.Data.ListWithdraw.unshift(arr)
                    }
                    $scope.show1 = result.Data.ListRecharge;
                    $scope.show2 = result.Data.ListInvestor;
                    $scope.show3 = result.Data.ListWithdraw;//hover数据用
                    $scope.d0_1 = deepClone(result.Data.ListRecharge);
                    $scope.d0_2 = deepClone(result.Data.ListInvestor);
                    $scope.d0_3 = deepClone(result.Data.ListWithdraw);

                    if (!$scope.d0_1.length && !$scope.d0_2.length && !$scope.d0_3.length) {
                        for (i = 0; i < 25; i++) {
                            $scope.d0_1.push([i, 0]);
                            $scope.d0_2.push([i, 0])
                            $scope.d0_3.push([i, 0])
                        }
                        tf = false//上线无数据自己填充 且不显示
                    }
                    $scope.d0_1.forEach(ele => {//处理万元
                        ele[1] = (ele[1] / 10000).toFixed(0);
                        if (ele[1] > 50) {
                            ele[1] = 55
                        }
                    });
                    $scope.d0_2.forEach(ele => {
                        ele[1] = (ele[1] / 10000).toFixed(0);
                        if (ele[1] > 50) {
                            ele[1] = 55
                        }
                    });
                    $scope.d0_3.forEach(ele => {
                        ele[1] = (ele[1] / 10000).toFixed(0)
                        if (ele[1] > 50) {
                            ele[1] = 55
                        }
                    });
                    txt = '金额';
                    people = '万'
                } else {
                    if(result.Data.ListRechargeNum.length && result.Data.ListInvestorNum.length && result.Data.ListWithdrawNum.length){
                        let arr = [0, 0]
                        result.Data.ListRechargeNum.unshift(arr)
                        result.Data.ListInvestorNum.unshift(arr)
                        result.Data.ListWithdrawNum.unshift(arr)
                    }
                    
                    $scope.show1 = result.Data.ListRechargeNum;
                    $scope.show2 = result.Data.ListInvestorNum;
                    $scope.show3 = result.Data.ListWithdrawNum;//hover数据用
                    $scope.d0_1 = deepClone(result.Data.ListRechargeNum);
                    $scope.d0_2 = deepClone(result.Data.ListInvestorNum);
                    $scope.d0_3 = deepClone(result.Data.ListWithdrawNum);
                    if (!$scope.d0_1.length && !$scope.d0_2.length && !$scope.d0_3.length) {
                        for (i = 0; i < 25; i++) {
                            $scope.d0_1.push([i, 0]);
                            $scope.d0_2.push([i, 0]);
                            $scope.d0_3.push([i, 0]);
                        }
                        tf = false//上线无数据自己填充 且不显示
                    }
                    console.log($scope.d0_1)
                    $scope.d0_1.forEach(ele => {//处理万元
                        if (ele[1] > 50) {
                            ele[1] = 55
                        }
                    });
                    $scope.d0_2.forEach(ele => {
                        if (ele[1] > 50) {
                            ele[1] = 55
                        }
                    });
                    $scope.d0_3.forEach(ele => {
                        if (ele[1] > 50) {
                            ele[1] = 55
                        }
                    });
                    txt = '人数';
                    people = '人'
                }
                $scope.dataname = [
                    { data: $scope.d0_1, label: '充值' + txt, points: { show: tf }, lines: { show: tf, fill: false } },
                    { data: $scope.d0_2, label: '投资' + txt, points: { show: tf }, lines: { show: tf, fill: false } },
                    { data: $scope.d0_3, label: '提现' + txt, points: { show: tf }, lines: { show: tf, fill: false } }
                ]
                $scope.newdata = {
                    colors: ['#5586ff', '#f3578a', '#ffa14d'],
                    series: { shadowSize: 2 },
                    xaxis: { font: { color: '#ccc' }, ticks: [[0, '0点'], [1, '1点'], [2, '2点'], [3, '3点'], [4, '4点'], [5, '5点'], [6, '6点'], [7, '7点'], [8, '8点'], [9, '9点'], [10, '10点'], [11, '11点'], [12, '12点'], [13, '13点'], [14, '14点'], [15, '15点'], [16, '16点'], [17, '17点'], [18, '18点'], [19, '19点'], [20, '20点'], [21, '21点'], [22, '22点'], [23, '23点']], tickDecimals: 0 },
                    yaxis: { font: { color: '#ccc' }, ticks: [[0, '0' + people], [5, '5' + people], [10, '10' + people], [15, '15' + people], [20, '20' + people], [25, '25' + people], [30, '30' + people], [35, '35' + people], [40, '40' + people], [45, '45' + people], [50, '50' + people]] },
                    grid: { hoverable: true, clickable: true, borderWidth: 0, color: '#333' },
                    tooltip: true,
                    tooltipOpts: {
                        content: function (label, xval, yval) {
                            if (label == '充值金额') {
                                yval = ($scope.show1[xval][1] / 10000).toFixed(0)
                            } else if (label == '投资金额') {
                                yval = ($scope.show2[xval][1] / 10000).toFixed(0)
                            } else if (label == '提现金额') {
                                yval = ($scope.show3[xval][1] / 10000).toFixed(0)
                            }
                            if (label == '充值人数') {
                                yval = $scope.show1[xval][1]
                            } else if (label == '投资人数') {
                                yval = $scope.show2[xval][1]
                            } else if (label == '提现人数') {
                                yval = $scope.show3[xval][1]
                            }
                            var content = xval + '点' + label + yval + (people == '万' ? '万元' : '人');
                            return content;
                        }, defaultTheme: false, shifts: { x: 0, y: 20 }
                    }
                }
                $.plot('#flot', $scope.dataname, $scope.newdata);
            } else {

            }
        }, function () {
            toaster.pop('error', '失败', '后台返回报错');
        }, "get");

        $scope.uptop = function (type) {
            var modalInstance = $modal.open({
                templateUrl: 'tpl/model/delPmodel.html?v=' + Math.random(),
                controller: ['$scope', '$modalInstance', 'raise', function ($scope, $modalInstance) {
                    $scope.toplist = type;
                    if (type == 1) {//投资额10
                        commonFactory.loading(true)
                        commonFactory.ajax("/Api/FixedOperation/GetOperationTender", { date: datetime }, function (result) {
                            commonFactory.loading(false)
                            if (result.Code == 1) {
                                $scope.GetOperationTender = result.Data
                            }
                        }, function () {
                            toaster.pop('error', '失败', '后台返回报错');
                        }, "get");
                    } else {//提现额10
                        commonFactory.loading(true)
                        commonFactory.ajax("/Api/FixedOperation/GetOperationWithdraw", { date: datetime }, function (result) {
                            commonFactory.loading(false)
                            if (result.Code == 1) {
                                $scope.GetOperationWithdraw = result.Data
                            }
                        }, function () {
                            toaster.pop('error', '失败', '后台返回报错');
                        }, "get");
                    }

                    $scope.cancel = function () {
                        $modalInstance.close();
                    };
                }
                ],
                size: 'lg',
                backdrop: true,
                resolve: {
                    raise: function () {
                        return;
                    }
                }
            });
            modalInstance.result.then(function () {
            }, function () {
            });
        }
    }
    initdata(newdate)
}]);